import React,{ Component } from "react"
import {BrowserRouter as Router,Route,Switch} from "react-router-dom";


import Home from "./page/home"
import Detail from "./page/detail"
import Reg from "./page/reg"
import Login from "./page/login"
import Shopstore from "./page/shopstore"
import Confirmorder from "./page/confirmorder"
import Mycollection from "./page/mycollection"
import Address from "./page/address"
import AddAddress from "./page/address/add"
import EditAddress from "./page/address/edit"


import Productlist from "./page/productlist"


const router = [
      {path:"/detail/:id",component:Detail},  
      {path:"/reg",component:Reg},  
      {path:"/login",component:Login},  
      {path:"/shopstore/:id",component:Shopstore},
      {path:"/confirmorder",component:Confirmorder},
      {path:"/mycollection",component:Mycollection}, 
      {path:"/address",component:Address},
      {path:"/addaddress",component:AddAddress}, 
      {path:"/editaddress/:id",component:EditAddress},
      {path:"/all",component:Productlist},  
      {path:"/",component:Home}
];






class App extends Component{
    render(){
      return(
          <div className="app">
            <Router>
                <Switch>
                    {router.map(item=>{
                        return  <Route path={item.path} component={item.component} key={item.component}/>
                    })}
                </Switch>
            </Router>
          </div>
      )
    }
}

export default App;